package szoftlab4sunak;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Polygon;

public class VTower implements VBattleDevice {
	
	private Tower ownTower;				//Taroljuk a Towert amihez tartozik a VTower
	private int x;						//X koordinata
	private int y;						//Y koordinata
	
	@Override
	//Kirajzolas
	public void draw(Graphics g) {
		g.setColor(new Color(204, 102, 0));
		//Az elhelyezett Ston-nak megfelelo szin beallitasa 
		if(ownTower.haveStone()){
			//SpeedStone
			if (ownTower.getStoneType() == 's'){
				g.setColor(Color.magenta);	
			}
			//DamageStone
			else if(ownTower.getStoneType() == 'd'){
				g.setColor(Color.WHITE);
			//RangeStone 	
			}else if(ownTower.getStoneType() == 'r'){
				g.setColor(Color.darkGray);
			}
		}
		//kod megjelenitese
		if(ownTower.isFog)
			g.setColor(Color.black);
		
		
		//Haromszog kirajzolasa
		x = ownTower.getPosx();
		y = ownTower.getPosyy();
		
		int xPoly[] = {x,x+50,x+100};		//Harom csucs X koordinatai
        int yPoly[] = {y, y-100, y};		//Harom csucs Y koordinatai
        
        
        Polygon poly = new Polygon(xPoly, yPoly, xPoly.length);
        g.fillPolygon(poly);
		
	}
	
	//A VTower-hez tartozo Tower vissza adasa
	public Tower getOwnTower() {
		return ownTower;
	}
	
	//A VTower-hez tartozo Tower beallitasa
	public void setOwnTower(Tower ownTower) {
		this.ownTower = ownTower;
	}
}
